import request from "@/utils/request"
import type { loginResult } from "../type/user"
const MOCK_HOST = "/mock-api/"
/***
 * @mockjs模拟数据
 */
export const loginApi = (loginParams: {
  username: string
  password: number
}) => {
  return request<loginResult>({
    url: "/login",
    method: "POST",
    data: loginParams,
  })
}
export const getUserInfoApi = (token: string) => {
  return request<any>({
    url: "/user",
    method: "POST",
    data: token,
  })
}

// 模拟异常请求
export const setErrorInfo = (token: string) => {
  return request<any>({
    url: "/error",
    method: "POST",
    data: token,
  })
}

// 模拟异常请求-404
export const setErrorInfo404 = (token: string) => {
  return request<any>({
    url: "/error404",
    method: "POST",
    data: token,
  })
}
